
package GUILayer;

import java.util.ArrayList;

import javax.swing.table.DefaultTableModel;
import ModelLayer.Ordre;
public class OrdreModelSingle extends DefaultTableModel {
        /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
		private Ordre ordre;

        public OrdreModelSingle()
        {
            ordre = new Ordre();
        }

    @Override
    public boolean isCellEditable(int row, int column) {
        return false;
    }

    
        
    public void setData(Ordre test)
    {
        this.ordre = test;
        fireTableDataChanged();
    }

    public Ordre getOrdre() {
        return ordre;
    }
    
    @Override
    public int getColumnCount() {
        return 3;
    }

    @Override
    public int getRowCount() 
    {
        if(ordre == null)
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }

    @Override
    public String getColumnName(int column) {
        String columnName = "";
        switch(column)
        {
            case 0:
            columnName = "KundeID";
            break;  
            case 1:
            columnName = "OrdreId";
            break;   
            case 2:
            columnName = "OrdreStatus";
            break;          

            
            
        }        
        return columnName;
    }
    
    

    @Override
    public Object getValueAt(int row, int column) 
    {
        Object value = null;
        switch(column)
        {
            case 0:
                value = ordre.getKundeId().getKundeID();
                break;
            case 1:
            	value = ordre.getOrderId();
                break;
            case 2:
            	value = ordre.getOrdreStatus();
                break;

           
            
        }
                
        return value;
    }
        
}